#include <stdio.h>
#include <math.h>
#define E 0.5*1e-5
int main()
{
	double x0, x1, f1, f2;
	int num;
	x1 = 0.5, num = 0;
	do {
		x0 = x1;
		f1 = x0 * exp(x0) - 1;
		f2 = exp(x0) + x0 * exp(x0);
		x1 = x0 - f1 / f2;
		num++;

	} while (fabs(x1 - x0) >= E);
	printf("The root is %lf.\n", x1);
	printf("The number of iterations is %d.\n", num);
	return 0;
}
